<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>修改密码</title>
<script src="../../static/Hunter/js/JQuery.js"
	data-th-src="@{/Hunter/js/jQuery.js}"></script>
<style type="text/css">
.zz {
	background: url("/Hunter/image/Hunter/changepass.png") no-repeat;
	width: 260px;
	height: 116px;
	position: fixed;
	bottom: 140px;
	left: 230px;
}
.xx {
    	display: none;    
}
#content {
	width: 500px;
	margin: 200px auto;
	text-align: center;
}

div {
	width: 500px;
	position: relative;
}

p {
	display: inline-block;
	background: url("/Hunter/image/Hunter/eye.png") no-repeat;
	background-size: 15px 15px;
	width: 15px;
	height: 30px;
	margin: 0;
	margin-top: 5px;
	position: relative;
	top: 20px;
	left: -16px;
	cursor: pointer;
}

input {
	height: 30px;
}

#submit {
	margin-top: 30px;
	width: 80px;
	border-radius: 20px;
	border: none;
}
</style>
</head>
<body>
	<div class="xx zz" id="sss"></div>
	<div id="content">
		<div>
			<label>请输入旧密码:<input class="pass" type="password" name="password"></label><p></p><br /> 
			<label>请输入新密码:<input class="pass" type="password" name="newPassword"></label><p></p><br /> 
			<input id="submit" type="button" value="提交" />
		</div>
	</div>
</body>
<script type="text/javascript">
	$(function(){
		$("p").hover(function(){
			$(this).prev().children(".pass").attr("type","text");
		},function(){
			$(this).prev().children(".pass").attr("type","password");
		})
		
		$("#submit").click(function(){
			let password=$(".pass").eq(0).val();
			let newPassword=$(".pass").eq(1).val();
			$.ajax({
				url:'/hunter/changePassword',
				type:'POST',
				data:{
						newPassword:newPassword
					},
				dataType:'text',
				success: function(r) {
						alert(r);
						$("#sss").removeClass("xx");
						$("submit").attr("disabled", "true");
						$(window.top).attr('location','/login');
						setTimeout(function() {
							$("#sss").addClass("xx");
							parent.location.reload()
						}, 1000);
					}
			});
		});
		
	});
</script>
</html>